package org.bmind.datasword.config.dto;

import org.bmind.datasword.utils.EqualsUtil;
import org.bmind.datasword.utils.HashCodeUtil;
import org.bmind.datasword.utils.StorageUtilities;


public class DPlot extends DObjCommon{
	/**
     * 
     */
    private static final long serialVersionUID = 1L;


	static { StorageUtilities.addREngineType(DPlot.class); }

		
		private String graphicsDevice = null;
		private int deviceHeight = 800;
		private int deviceWidth = 800;
		private DPlotType dPlotType = null;
		private int fHashCode ;

		public DPlot() {
			
		}

		/**
		 * @return the graphicsDevice
		 */
		public String getGraphicsDevice() {return graphicsDevice;}
		public void setGraphicsDevice(String graphicsDevice) {this.graphicsDevice = graphicsDevice;}

		/**
		 * @return the deviceHeight
		 */
		public int getDeviceHeight() {return deviceHeight;}
		public void setDeviceHeight(int deviceHeight) {this.deviceHeight = deviceHeight;}

		/**
		 * @return the deviceWidth
		 */
		public int getDeviceWidth() {return deviceWidth;}
		public void setDeviceWidth(int deviceWidth) {this.deviceWidth = deviceWidth;}

		/**
		 * 
		 * @return RPlotType
		 */
		public DPlotType getDPlotType() {return dPlotType;}
		public void setDPlotType(DPlotType dPlotType) {this.dPlotType = dPlotType;}
		
		
		/* (non-Javadoc)
	     * @see org.bmind.datasword.config.dto.DObjCommon#equals(java.lang.Object)
	     */
	    @Override
	    public boolean equals(Object obj) {
	        if ( this == obj ) return true;
	 	    if ( !(obj instanceof DData) ) return false;
	 	   
	 	    DPlot dPl = (DPlot)obj;
	     	
	     	return	EqualsUtil.areEqual(this.name, dPl.name) &&
	     			EqualsUtil.areEqual(this.label, dPl.label) &&
	     			EqualsUtil.areEqual(this.hint, dPl.hint) &&
	     			EqualsUtil.areEqual(this.exec, dPl.exec) &&
	     			EqualsUtil.areEqual(this.visible, dPl.visible) &&
	     			EqualsUtil.areEqual(this.dEngineType, dPl.dEngineType) &&
	     			EqualsUtil.areEqual(this.fParameter, dPl.fParameter) &&
	     			EqualsUtil.areEqual(this.Library, dPl.Library) &&
	     			EqualsUtil.areEqual(this.getDPlotType(), dPl.getDPlotType()) &&
	     			EqualsUtil.areEqual(this.getfParameter(), dPl.getFunction()) &&
	     			EqualsUtil.areEqual(this.getAreas(), dPl.getAreas()) &&
	     			EqualsUtil.areEqual(this.getRoles(), dPl.getRoles()) &&
	     			EqualsUtil.areEqual(this.getFunction(), dPl.getFunction()) &&
	     			EqualsUtil.areEqual(this.getID(), dPl.getID()) &&
	     			EqualsUtil.areEqual(this.getNextId(), dPl.getNextId()) &&
	     			EqualsUtil.areEqual(this.getDeviceHeight(), dPl.getDeviceHeight()) &&
	     			EqualsUtil.areEqual(this.getDeviceWidth(), dPl.getDeviceWidth()) && 
	     			EqualsUtil.areEqual(this.getGraphicsDevice(), dPl.getGraphicsDevice()) && 
	     			EqualsUtil.areEqual(this.getVersion(), dPl.getVersion());
	    }

	    
		/* (non-Javadoc)
	     * @see org.bmind.datasword.config.dto.DObjCommon#hashCode()
	     */
		@Override
		public int hashCode() {
			
			// this style of lazy initialization is
			// suitable only if the object is immutable
			if (fHashCode == 0) {
			int result = HashCodeUtil.SEED;
				result = HashCodeUtil.hash(result, getID());
				result = HashCodeUtil.hash(result, getNextId());
				result = HashCodeUtil.hash(result, getPreviusId());
				result = HashCodeUtil.hash(result, getAreas());
				result = HashCodeUtil.hash(result, getRoles());
				result = HashCodeUtil.hash(result, getEngineType());
				result = HashCodeUtil.hash(result, getfParameter());
				result = HashCodeUtil.hash(result, getLabel());
				result = HashCodeUtil.hash(result, getLibrary());
				result = HashCodeUtil.hash(result, getFunction());
				result = HashCodeUtil.hash(result, getDPlotType());
				result = HashCodeUtil.hash(result, getLabel());
				result = HashCodeUtil.hash(result, getHint());
				result = HashCodeUtil.hash(result, getVisible());
				result = HashCodeUtil.hash(result, getDeviceHeight());
				result = HashCodeUtil.hash(result, getDeviceWidth());
				result = HashCodeUtil.hash(result, getGraphicsDevice());
				fHashCode = result;
			}
			return fHashCode;
		}
		
		
		
}
